const mysql = require('../node_modules/mysql');

let config = {
    "host":'192.168.111.144',
    "user":"root",
    "password":"ddd",
    "database":"mydatabase"
}
let con = mysql.createConnection(config);
con.connect();

let obj = {};
obj.query = async function (sqlStr,arr) {
    // con.connection();
    return await new Promise((resolve,reject) => {
        con.query(sqlStr , arr , (e , res) => {
            if (e) {
                reject(e)
            }
            else{
                resolve(res)
            }
        })
    })
    
}

module.exports = obj;